#ifndef LANGUAGECONTROL_H
#define LANGUAGECONTROL_H

#include <QApplication>
#include <QCoreApplication>
#include <QFile>
#include <QObject>
#include <QQmlEngine>
#include <QTranslator>

class LanguageControl : public QObject
{
    Q_OBJECT

    Q_PROPERTY(int CurrentLanguage READ CurrentLanguage WRITE setCurrentLanguage NOTIFY
                   CurrentLanguageChanged FINAL)

public:
    explicit LanguageControl(QQmlEngine *engine);

    Q_INVOKABLE void load_Language(int index);

    int CurrentLanguage() const;
    void setCurrentLanguage(int newCurrentLanguage);

signals:
    void CurrentLanguageChanged();

private:
    int m_CurrentLanguage;

    QTranslator *m_Translator = nullptr;

    QQmlEngine *m_Engine = nullptr;
};

#endif // LANGUAGECONTROL_H
